using System;
using System.Collections.Generic;
using System.Text;
using RSSRadio.Model;

namespace RSSRadio
{
	enum MediaFileType
	{
		Avi,
		Wmv,
		Divx,
		MpegVideo,
		Mpeg4Video,
		Unknown
	}

	class MediaFileUtil
	{
		public static MediaFileType GetFileType(string fileName)
		{
			char[] separator = { '.' };
			string[] splitFileName = fileName.Split(separator);
			string fileExtension = splitFileName[splitFileName.Length - 1].ToLower();

			switch (fileExtension)
			{
				case "avi":
					return MediaFileType.Avi;
				case "wmv":
					return MediaFileType.Wmv;
				case "divx":
					return MediaFileType.Divx;
				case "mpg":
					return MediaFileType.MpegVideo;
				case "mp4":
					return MediaFileType.Mpeg4Video;
				default:
					return MediaFileType.Unknown;
			}
		}

		public static bool IsVideo(MediaFileType fileType)
		{
			switch (fileType)
			{
				case MediaFileType.Avi:
					return true;
				case MediaFileType.Divx:
					return true;
				case MediaFileType.MpegVideo:
					return true;
				case MediaFileType.Mpeg4Video:
					return true;
				case MediaFileType.Wmv:
					return true;
				default:
					return false;
			}
		}


        public static String getFilenameForEpisode(EpisodeDetails episodeDetails)
        {
            return Globals.AppSettings.DownloadedPodcastDir + @"\" + episodeDetails.GetMediaFileName();
        }
	}
}
